﻿namespace MicroCloud.Message.Database
{
    /// <summary>
    /// 消息实体映射配置
    /// </summary>
    public class MessageConfiguration : EntityTypeConfigurationBase<MessageEntity, long>
    {
        /// <summary>
        /// 重写以实现实体类型各个属性的数据库配置
        /// </summary>
        /// <param name="builder">实体类型创建器</param>
        public override void Configuration(EntityTypeBuilder<MessageEntity> builder)
        {
            builder.HasIndex(m => new { m.BaseType, m.BaseId }).SetIndex("BaseTypeId");
            builder.HasIndex(m => m.Method).SetIndex("Method");
            builder.HasIndex(m => m.SenderId).SetIndex("SenderId");
            builder.HasIndex(m => m.IsSent).SetIndex("IsSent");

            ConfigurationAppend(builder);
        }

    }

}
